﻿@model Dictionary<int, Item>

@{
    var name = (string)ViewData["Name"];
    var startPos = (int)ViewData["startPos"];   
}

@helper Img(int left, int top, int pos)
{
    if (Model == null)
    { 
        <img class="cell @ViewData["Class"]" style="width:50px;height:55px;position:absolute;left:@(left)px;top:@(top)px;cursor:pointer" 
                src="@Url.Content("~/Content/1px.png")" 
                data-pos="@pos" />
    }
    else
    {
        if (Model.ContainsKey(pos))
        {
             @Html.LinkOnItem(Model[pos], width: 50, height: 55, htmlAttributes: new { @class=@ViewData["Class"], style = "position:absolute;left:" + left + "px;top:" + top + "px" }) 
        }
    }
}

<div style="background-image:url(@Url.Content("~/Content/inventory.jpg"));width:193px;height:276px;float:left;text-align:center;padding-top:2px;font-weight:bold;position:relative">
    <span style="color:gold;font-size:medium;">@name</span>
    
    @Img(35,85,startPos + 1)
    @Img(98,85,startPos + 2)

    @Img(35,151,startPos + 3)
    @Img(98,151,startPos + 4)
        
    @Img(35,217,startPos + 5)
    @Img(98,217,startPos + 6)
</div> 